<div class="span5">
<h1 style="padding-left:20px;">Notifications</h1>
<?php
	
	if (isset($_GET['page'])) {
		$page = $_GET['page'];
	} else {
		$page = 1;
	}
	$notification_list = $user->getNotificationList($page);
	if ($notification_list !== null) {
		foreach ($notification_list as $notification) {
			$notification_object = Notification::createNotification($notification['notification_id']);
            if(stristr($notification_object,'success')){
                $colour = '"alert alert-success"';
            } else if(stristr($notification_object,'already')){
                $colour = '"alert alert-error"';
            } else {
                $colour = '"alert alert-info"';
            }
			switch (Notification::findTypeName($notification_object->getTypeID())) {
				case 'request_doctor':
					$url = 'patients.php';
					break;
				case 'request_patient':
					$url = 'request.php';
					break;
				case 'log_doctor':
					$url = 'patients.php';
					break;
				case 'reminder_user':
					$url = 'calendar.php';
					break;
				case 'food_doctor':
					$url = 'patient.php';
					break;
				case 'symptom_doctor':
					$url = 'patient';
					break;
			}
			$messages = explode('.',$notification_object);
            $end = $messages[count($messages)-2];
            $rest = substr($notification_object,0,-strlen($end));
			echo '<div href="'.$url.'" class='.$colour.'><b>'.$rest.'</b>'.$end.'</div>';
		}
	} else {
		echo constant("MSG_NOTIFICATION_NONE");
	}

?>

</div>